package com.ecb.business.controller;

import com.ecb.business.dto.api.ApiResult;
import com.ecb.business.dto.organization.OrganizationDTO;
import com.ecb.business.dto.organization.QueryOrganizationDTO;
import com.ecb.business.service.OrganizationManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("organization")
@Api(tags = "组织管理")
public class OrganizationController {

    @Autowired
    OrganizationManageService organizationManageService;

    @GetMapping("getAllOrg")
    @ApiOperation(value = "查询组织信息",notes = "")
    public ApiResult getAllOrg(@RequestBody QueryOrganizationDTO queryDTO){
        return ApiResult.T(organizationManageService.getAllOrg(queryDTO));
    }

    @PostMapping("addOrg")
    @ApiOperation(value = "添加组织",notes = "")
    public ApiResult addOrg(@RequestBody OrganizationDTO addDTO ){
        return ApiResult.T(organizationManageService.addOrg(addDTO));
    }

    @PostMapping("updateOrg")
    @ApiOperation(value = "更新组织信息",notes = "")
    public ApiResult updateOrg(@RequestBody OrganizationDTO organizationDTO ){
        return ApiResult.T(organizationManageService.updateOrg(organizationDTO));
    }
    @PostMapping("deleteOrg")
    @ApiOperation(value = "删除组织",notes = "")
    public ApiResult deleteOrg(@RequestBody OrganizationDTO organizationDTO  ){
        return ApiResult.T(organizationManageService.deleteOrg(organizationDTO));
    }
}
